package 力扣;

public class offer58 {
    public static void main(String[] args) {
        reverseLeftWords("abcdefg",2);
    }
    public static String reverseLeftWords(String s, int n) {
        char[] chars = s.toCharArray();
        char[] temp=new char[n];
        for (int i=0;i<n;i++){
            temp[i]=chars[i];
        }
        int count=0;
        for (int i=n;i<chars.length;i++){
            chars[count]=chars[i];
            count++;
        }
        int j=0;
        for (int i=count;i<s.length();i++){
            chars[i]=temp[j];
        }
        return new String(chars);
    }
}
